﻿$(function () {
    $.ajax({
        type: 'POST',
        async: false,
        contentType: 'application/json; charset=utf-8',
        url: '../DataService.asmx/GetLocationForCurrentEvent',
        data: '{}',
        dataType: 'json',
        success: function (msg) {
            var map;
            var geocoder;
            debugger;
            $('#address').html(msg.d.Location);
            if (GBrowserIsCompatible()) {
                map = new GMap2(document.getElementById("map"));
                map.setCenter(new GLatLng(41.99593, 21.43145), 15);
                map.setUIToDefault();
                var point = new GLatLng(msg.d.Latitude, msg.d.Longitude);
                var marker = new GMarker(point);
                GEvent.addListener(marker, "click", function () {
                    marker.openInfoWindow(msg.d.Location);
                });
                map.addOverlay(marker);
                marker.openInfoWindow(msg.d.Location);


            }
        },
        error: function () {
            alert("Problem occured while loading map");

        }
    });
});